package com.gpb.common.method;

import java.util.ArrayList;
import java.util.List;

import com.gpb.common.security.aes.AES;

import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateModelException;

/**
 * 解码
 * @author GuoPengBin
 * @dateTime Mar 25, 2014  5:05:08 PM
 */
public class DecryptMethod implements TemplateMethodModel {

	public Object exec(List arg0) throws TemplateModelException {
		try {
			if(arg0.size()>0){
				return AES.decryptFromBase64(arg0.get(0).toString());
				//return AES.encryptToBase64(arg0.get(0).toString());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	public static void main(String[] args)  throws TemplateModelException{
		List list=new ArrayList();
		//list.add("622554546464646");
		list.add("ETMNu+FZR57H/JZ/wbHNIA==");
		System.out.println(new DecryptMethod().exec(list));
	}
}
